package com.tgslc.defaultManagement.manage;

import com.tgslc.defaultManagement.utils.ADFUtils;
import com.tgslc.defaultManagement.utils.Borrower;

import javax.faces.event.ActionEvent;

import oracle.adf.view.rich.component.rich.data.RichTable;

import oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding;

import oracle.binding.OperationBinding;

import oracle.jbo.Row;

public class myBean {
  private RichTable myTable;
  private Long borrowerId;

  public myBean() {
    super();
  }

  public void borrowerIdClicked(ActionEvent actionEvent) {
    RichTable table = this.getMyTable();
    FacesCtrlHierNodeBinding binding =  (FacesCtrlHierNodeBinding) table.getSelectedRowData();
    Row row  = binding.getCurrentRow();
    Long borrowerId = (Long) row.getAttribute(0);
    System.out.println(borrowerId);
    this.borrowerId = borrowerId;
    
    OperationBinding opBinding = ADFUtils.findOperation("fetchBorrower");
    opBinding.getParamsMap().put("borrowerId", borrowerId);
    opBinding.execute();
  }

  public void setMyTable(RichTable myTable) {
    this.myTable = myTable;
  }

  public RichTable getMyTable() {
    return myTable;
  }

  public void setBorrowerId(Long borrowerId) {
    this.borrowerId = borrowerId;
  }

  public Long getBorrowerId() {
    return borrowerId;
  } 
  
}
